﻿#ifndef SAMPLEWINDOW_H
#define SAMPLEWINDOW_H

#include <QWidget>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QObject>
#include <dbHelper.h>
#include <QShowEvent>
#include <QHBoxLayout>
#include <QDebug>
#include <CommonHelper.h>
#include <tcpclient.h>
#include <QApplication>
#include <QScreen>
#include <QPixmap>
#include <QDir>
#include <QElapsedTimer>
#include <mainwindow.h>
#include <getTempThread.h>
#include <QMessageBox>
#include <loghelper.h>
#include <eqptinfo.h>
#include <QWidget>
#include <QLabel>
#include <QPainter>
#include <QColor>
#include <QDomDocument>
#include <intListener.h>
#include <tcpServer.h>
#include <serialportThread.h>
#include <ftpAccessManager.h>
#include "alert.h"
#include "ui_alert.h"

class TriangleCornerLabel : public QLabel {
protected:
    void paintEvent(QPaintEvent *event) override;

public:
    // 默认构造函数
    TriangleCornerLabel(QWidget *parent = nullptr) : QLabel(parent) {
    }
};

class TriangleCornerLabel2 : public QLabel {
protected:
    void paintEvent(QPaintEvent *event) override;

public:
    // 默认构造函数
    TriangleCornerLabel2(QWidget *parent = nullptr) : QLabel(parent) {
    }
};

class TriangleCornerLabel4 : public QLabel {
protected:
    void paintEvent(QPaintEvent *event) override;

public:
    // 默认构造函数
    TriangleCornerLabel4(QWidget *parent = nullptr) : QLabel(parent) {
    }
};

namespace Ui {
class SampleWindow;
}

class SampleWindow : public QWidget
{
    Q_OBJECT

public:
    explicit SampleWindow(QWidget *parent = nullptr);
    ~SampleWindow();

signals:
    void changeMainWindow();
    void changeExpInfoWindow();
    void startTempThread();
    void changeExpeWindow();
    void changeDataAnalyWindow();

private slots:
    void on_returnBtn_clicked();
    void on_SampleName_editTextChanged(const QString &arg1);
    void on_SampleType_activated(const QString &arg1);
    void on_SampleConc_editingFinished();
    void on_ClearBtn_clicked();
    void on_LoadAllBtn_clicked();
    void on_CancelLoadBtn_clicked();
    void on_SaveBtn_clicked();
    void on_BeginBtn_clicked();
    void on_checkBox_clicked();
    void on_checkBox_2_clicked();
    void on_checkBox_4_clicked();
    void on_checkBox_3_clicked();
    void on_pushButton_7_clicked();
    void on_pushButton_8_clicked();
    void on_pushButton_3_clicked();

    void on_tableWidget_cellPressed(int row, int column);

    void on_SampleConc_textEdited(const QString &arg1);

    void wlkout();
    void on_pushButton_clicked();

private:
    void RefreshSampleInfo();
    void showEvent(QShowEvent *event) override;
    QString GetDateString(int);
    void changeToMainWindow();
    void resizeEvent(QResizeEvent *event) override;
    void refShadeWindow();
    void oneMachineStartExperiment();
    void startExperiment();
    void backBaseInfo();

private:
    Ui::SampleWindow *ui;
    CommonHelper* common;
    TcpClient* tcpClient;
    SerialportThread* serialClient;
    TcpServer* tcpServer;
    loghelper* logClient;
    GetTempThread* tempThread = nullptr;
    QList<QTableWidgetSelectionRange> selectedItems;
    QWidget*  mpShadeWindow;
    ftpAccessManager mFtpAccMgr;

    alert *alertv;
};

#endif // SAMPLEWINDOW_H
